#%%
from general import *
list = os.listdir("post")
arr=[]
for name in list:
	arr.append(get("post\\"+name))
arr.sort()
arr.reverse()
print(arr)
for i in range(0,len(arr)):
	pre=""
	nxt=""
	if i!=len(arr)-1:
		nxt="\\article\\"+arr[i+1][2]+'.html'
	if i!=0:
		pre="\\article\\"+arr[i-1][2]+'.html'
	write("article\\"+arr[i][2]+'.html',work("post\\"+arr[i][2]+".md",pre,nxt))
print(Ts,Cs,Ys)
#%%
result=[arr[i:i+prepage] for i in range(0,len(arr),prepage)]
for i in range(0,len(result)):
	write("archives\\"+str(i+1)+".html",work2(result[i],i+1,len(result),"/archives/").replace('<li><a href="/archives/">','<li class="active"><a href="/archives/">'))
shutil.copyfile("archives\\1.html", "archives\\index.html")
#%%
workTag(arr)
# %%
workIndex([arr[i][1:] for i in range(0,len(arr))])
# %%
